package casino;

import java.awt.Color;

public class Message {
	private int len;
	private int timeout;
	private String message;
	private Casino casino;
	
	public Message(Casino n, String s, int time){
		casino = n;
		message = s;
		len = time;
		timeout = time;
	}
	
	public void update(){
		timeout--;
		if(timeout < 0){
			removeSelf();
		}
	}
	
	public String message(){
		return message;
	}
	
	public Color drawColor(){
		return new Color(255, 0, 0, (Math.abs(timeout)*255)/len);
	}
	
	public void removeSelf(){
		casino.messages.remove(this);
	}
}
